package com.rickpan.dto.response;



/**
 * 团队消息响应DTO
 */
public class TeamMessageDTO {

    private Long id;
    private Long teamId;
    private Long senderId;
    private String senderName;
    private String senderAvatar;
    private String content;
    private String messageType; // text, file, image, emoji
    private String fileName;
    private String fileUrl;
    private Long fileSize;
    private String mimeType;
    private String messageStatus; // sending, sent, failed
    private Long replyToId;
    private Integer retryCount; // RabbitMQ重试次数

    // 加密相关字段
    private String iv; // 初始化向量
    private String encryptionAlgorithm; // 加密算法
    private Integer keyVersion; // 密钥版本
    private Boolean isEncrypted; // 是否加密

    private Long timestamp;

    // 构造函数
    public TeamMessageDTO() {}

    public TeamMessageDTO(Long teamId, Long senderId, String content, String messageType) {
        this.teamId = teamId;
        this.senderId = senderId;
        this.content = content;
        this.messageType = messageType;
        this.timestamp = System.currentTimeMillis();
    }

    // Getter 和 Setter 方法
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getTeamId() {
        return teamId;
    }

    public void setTeamId(Long teamId) {
        this.teamId = teamId;
    }

    public Long getSenderId() {
        return senderId;
    }

    public void setSenderId(Long senderId) {
        this.senderId = senderId;
    }

    public String getSenderName() {
        return senderName;
    }

    public void setSenderName(String senderName) {
        this.senderName = senderName;
    }

    public String getSenderAvatar() {
        return senderAvatar;
    }

    public void setSenderAvatar(String senderAvatar) {
        this.senderAvatar = senderAvatar;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getMessageType() {
        return messageType;
    }

    public void setMessageType(String messageType) {
        this.messageType = messageType;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public String getFileUrl() {
        return fileUrl;
    }

    public void setFileUrl(String fileUrl) {
        this.fileUrl = fileUrl;
    }

    public Long getFileSize() {
        return fileSize;
    }

    public void setFileSize(Long fileSize) {
        this.fileSize = fileSize;
    }

    public String getMimeType() {
        return mimeType;
    }

    public void setMimeType(String mimeType) {
        this.mimeType = mimeType;
    }

    public Long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Long timestamp) {
        this.timestamp = timestamp;
    }

    public String getMessageStatus() {
        return messageStatus;
    }

    public void setMessageStatus(String messageStatus) {
        this.messageStatus = messageStatus;
    }

    public Long getReplyToId() {
        return replyToId;
    }

    public void setReplyToId(Long replyToId) {
        this.replyToId = replyToId;
    }

    public Integer getRetryCount() {
        return retryCount;
    }

    public void setRetryCount(Integer retryCount) {
        this.retryCount = retryCount;
    }

    // 加密字段的getter和setter
    public String getIv() {
        return iv;
    }

    public void setIv(String iv) {
        this.iv = iv;
    }

    public String getEncryptionAlgorithm() {
        return encryptionAlgorithm;
    }

    public void setEncryptionAlgorithm(String encryptionAlgorithm) {
        this.encryptionAlgorithm = encryptionAlgorithm;
    }

    public Integer getKeyVersion() {
        return keyVersion;
    }

    public void setKeyVersion(Integer keyVersion) {
        this.keyVersion = keyVersion;
    }

    public Boolean getIsEncrypted() {
        return isEncrypted;
    }

    public void setIsEncrypted(Boolean isEncrypted) {
        this.isEncrypted = isEncrypted;
    }

    @Override
    public String toString() {
        return "TeamMessageDTO{" +
                "id=" + id +
                ", teamId=" + teamId +
                ", senderId=" + senderId +
                ", senderName='" + senderName + '\'' +
                ", content='" + (isEncrypted != null && isEncrypted ? "[ENCRYPTED]" : content) + '\'' +
                ", messageType='" + messageType + '\'' +
                ", fileName='" + (isEncrypted != null && isEncrypted ? "[ENCRYPTED]" : fileName) + '\'' +
                ", iv='" + (iv != null ? "[PRESENT]" : null) + '\'' +
                ", encryptionAlgorithm='" + encryptionAlgorithm + '\'' +
                ", keyVersion=" + keyVersion +
                ", isEncrypted=" + isEncrypted +
                ", timestamp=" + timestamp +
                '}';
    }
}
